<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <title>留言与回复 - 社交平台</title>
  <!-- Bootstrap 5 CSS -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <!-- Font Font Awesome -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
  
  <style>
    body {
      background-color: #f8f9fa;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      padding-bottom: 80px;
    }
    
    /* 导航栏样式 */
    .navbar {
      box-shadow: 0 2px 8px rgba(0,0,0,0.08);
      z-index: 1050;
    }
    
    /* 留言列表通用样式 */
    .message-section {
      margin-bottom: 30px;
      padding-top: 15px;
      border-top: 1px solid #eee;
    }
    
    .message-section:first-child {
      border-top: none;
    }
    
    .message-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      object-fit: cover;
    }
    
    .no-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background-color: #e3f2fd;
      color: #1976d2;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .message-time {
      font-size: 12px;
      color: #999;
    }
    
    .message-content {
      line-height: 1.5;
    }
    
    /* 卡片式留言样式 */
    .card-message {
      transition: transform 0.2s, box-shadow 0.2s;
    }
    
    .card-message:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }
    
    /* 气泡式留言样式 */
    .bubble-message {
      position: relative;
      border-radius: 18px;
    }
    
    .bubble-message:before {
      content: '';
      position: absolute;
      left: -10px;
      top: 12px;
      border-top: 10px solid transparent;
      border-right: 10px solid white;
      border-bottom: 10px solid transparent;
    }
    
    /* 回复样式 */
    .reply-item {
      border-left: 2px solid #e9ecef;
      padding-left: 15px;
      margin-left: 15px;
      margin-top: 10px;
    }
    
    .reply-form {
      transition: all 0.3s;
      max-height: 0;
      overflow: hidden;
    }
    
    .reply-form.active {
      max-height: 200px;
      margin-top: 15px;
    }
    
    /* 紧凑式留言样式 */
    .compact-message {
      transition: background-color 0.2s;
    }
    
    .compact-message:hover {
      background-color: #f8fafc;
    }
    
    /* 带图片的留言样式 */
    .message-images {
      display: flex;
      gap: 5px;
      margin: 8px 0;
      border-radius: 8px;
      overflow: hidden;
    }
    
    .message-images img {
      width: 80px;
      height: 80px;
      object-fit: cover;
    }
    
    /* 底部输入框 */
    .bottom-input {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background-color: white;
      padding: 10px 15px;
      box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
      z-index: 1040;
    }
  </style>
</head>
<body>
  <!-- 顶部导航栏 -->
  <nav class="navbar navbar-light bg-white fixed-top">
    <div class="container-fluid px-4">
      <button class="btn btn-link p-0 me-2" type="button">
        <i class="fa fa-arrow-left text-dark"></i>
      </button>
      <h5 class="navbar-brand mb-0 fw-bold flex-grow-1 text-center">留言与回复</h5>
      <button class="btn btn-link p-0" type="button">
        <i class="fa fa-search text-dark"></i>
      </button>
    </div>
  </nav>

  <!-- 主内容区 -->
  <div class="container-fluid px-4" style="margin-top: 56px; padding-top: 15px;">
    <!-- 1. 标准卡片式留言 -->
    <div class="message-section">
      <h6 class="fw-bold mb-3">标准卡片式留言</h6>
      
      <!-- 留言1 -->
      <div class="card card-message mb-3">
        <div class="card-body p-4">
          <div class="d-flex justify-content-between mb-3">
            <div class="d-flex align-items-center">
              <img src="https://picsum.photos/200/200?random=1" class="message-avatar me-3" alt="用户头像">
              <div>
                <h6 class="mb-0 fw-bold">李明</h6>
                <span class="message-time">今天 10:24</span>
              </div>
            </div>
            <button class="btn btn-link p-0 text-secondary">
              <i class="fa fa-ellipsis-h"></i>
            </button>
          </div>
          
          <p class="message-content mb-3">
            大家觉得新推出的社区功能怎么样？我觉得这个更新非常实用，特别是消息通知变得更及时了。
          </p>
          
          <div class="d-flex justify-content-between align-items-center">
            <div class="d-flex gap-4">
              <button class="btn btn-link p-0 text-secondary">
                <i class="fa fa-heart-o me-1"></i> 24
              </button>
              <button class="reply-btn btn btn-link p-0 text-secondary">
                <i class="fa fa-reply me-1"></i> 回复(8)
              </button>
            </div>
            <button class="btn btn-link p-0 text-secondary">
              <i class="fa fa-share-alt"></i>
            </button>
          </div>
          
          <!-- 回复列表 -->
          <div class="replies mt-3">
            <!-- 回复1 -->
            <div class="reply-item">
              <div class="d-flex justify-content-between mb-1">
                <div class="d-flex align-items-center">
                  <div class="no-avatar me-2">
                    <i class="fa fa-user"></i>
                  </div>
                  <div>
                    <h6 class="mb-0 fw-bold text-sm">王芳</h6>
                    <span class="message-time">今天 10:32</span>
                  </div>
                </div>
              </div>
              <p class="message-content mb-2 text-sm">
                我也觉得不错，界面也比之前更简洁了
              </p>
              <div class="d-flex gap-3 mb-2">
                <button class="btn btn-link p-0 text-secondary text-sm">
                  <i class="fa fa-heart-o me-1"></i> 5
                </button>
                <button class="reply-btn btn btn-link p-0 text-secondary text-sm">
                  <i class="fa fa-reply me-1"></i> 回复
                </button>
              </div>
            </div>
          </div>
          
          <!-- 回复输入框 -->
          <div class="reply-form">
            <div class="input-group">
              <input type="text" class="form-control rounded-pill" placeholder="写下你的回复...">
              <button class="btn btn-primary ms-2 rounded-pill">发送</button>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 留言2 -->
      <div class="card card-message">
        <div class="card-body p-4">
          <div class="d-flex justify-content-between mb-3">
            <div class="d-flex align-items-center">
              <div class="no-avatar me-3">
                <i class="fa fa-user"></i>
              </div>
              <div>
                <h6 class="mb-0 fw-bold">张伟</h6>
                <span class="message-time">昨天 18:45</span>
              </div>
            </div>
            <button class="btn btn-link p-0 text-secondary">
              <i class="fa fa-ellipsis-h"></i>
            </button>
          </div>
          
          <p class="message-content mb-3">
            有人参加周末的线下聚会吗？想认识一些新朋友，交流一下摄影技巧。
          </p>
          
          <div class="d-flex justify-content-between align-items-center">
            <div class="d-flex gap-4">
              <button class="btn btn-link p-0 text-secondary">
                <i class="fa fa-heart-o me-1"></i> 16
              </button>
              <button class="reply-btn btn btn-link p-0 text-secondary">
                <i class="fa fa-reply me-1"></i> 回复(5)
              </button>
            </div>
            <button class="btn btn-link p-0 text-secondary">
              <i class="fa fa-share-alt"></i>
            </button>
          </div>
          
          <!-- 回复输入框 -->
          <div class="reply-form">
            <div class="input-group">
              <input type="text" class="form-control rounded-pill" placeholder="写下你的回复...">
              <button class="btn btn-primary ms-2 rounded-pill">发送</button>
            </div>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 2. 气泡式留言 -->
    <div class="message-section">
      <h6 class="fw-bold mb-3">气泡式留言</h6>
      
      <!-- 左侧气泡（他人留言） -->
      <div class="d-flex mb-4">
        <img src="https://picsum.photos/200/200?random=3" class="message-avatar me-3" alt="用户头像">
        <div>
          <div class="d-flex items-center mb-1">
            <h6 class="mb-0 fw-bold me-2">赵丽</h6>
            <span class="message-time">今天 09:15</span>
          </div>
          <div class="bg-white bubble-message p-3 shadow-sm">
            <p class="message-content mb-0">
              请问有人知道如何设置隐私权限吗？想隐藏自己的在线状态
            </p>
          </div>
          <div class="d-flex gap-3 mt-1 ms-2">
            <button class="btn btn-link p-0 text-secondary text-sm">
              <i class="fa fa-heart-o me-1"></i> 3
            </button>
            <button class="reply-btn btn btn-link p-0 text-secondary text-sm">
              <i class="fa fa-reply me-1"></i> 回复
            </button>
          </div>
          
          <!-- 回复 -->
          <div class="reply-item mt-2">
            <div class="d-flex items-center mb-1">
              <h6 class="mb-0 fw-bold text-sm me-2">李明</h6>
              <span class="message-time">今天 09:20</span>
            </div>
            <div class="bg-white bubble-message p-2 shadow-sm">
              <p class="message-content mb-0 text-sm">
                在个人设置里，找到隐私选项，里面可以设置在线状态是否可见
              </p>
            </div>
          </div>
          
          <!-- 回复输入框 -->
          <div class="reply-form ms-2">
            <div class="input-group">
              <input type="text" class="form-control rounded-pill" placeholder="回复赵丽...">
              <button class="btn btn-primary ms-2 rounded-pill">发送</button>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 右侧气泡（自己的留言） -->
      <div class="d-flex justify-content-end mb-4">
        <div class="text-right">
          <div class="d-flex items-center justify-content-end mb-1">
            <span class="message-time me-2">昨天 21:35</span>
            <h6 class="mb-0 fw-bold">我</h6>
          </div>
          <div class="bg-primary text-white bubble-message p-3 shadow-sm" style="background-color: #0d6efd;">
            <p class="message-content mb-0">
              刚看到这个活动，很感兴趣，已经报名参加了！
            </p>
          </div>
          <div class="d-flex gap-3 mt-1 justify-content-end me-2">
            <button class="btn btn-link p-0 text-secondary text-sm">
              <i class="fa fa-heart-o me-1"></i> 8
            </button>
            <button class="reply-btn btn btn-link p-0 text-secondary text-sm">
              <i class="fa fa-reply me-1"></i> 回复
            </button>
          </div>
          
          <!-- 回复输入框 -->
          <div class="reply-form">
            <div class="input-group">
              <input type="text" class="form-control rounded-pill" placeholder="写下你的回复...">
              <button class="btn btn-primary ms-2 rounded-pill">发送</button>
            </div>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 3. 带图片的留言 -->
    <div class="message-section">
      <h6 class="fw-bold mb-3">带图片的留言</h6>
      
      <div class="card card-message mb-3">
        <div class="card-body p-4">
          <div class="d-flex justify-content-between mb-3">
            <div class="d-flex align-items-center">
              <img src="https://picsum.photos/200/200?random=5" class="message-avatar me-3" alt="用户头像">
              <div>
                <h6 class="mb-0 fw-bold">刘强</h6>
                <span class="message-time">3天前</span>
              </div>
            </div>
            <button class="btn btn-link p-0 text-secondary">
              <i class="fa fa-ellipsis-h"></i>
            </button>
          </div>
          
          <p class="message-content mb-3">
            分享几张上周旅行拍的照片，风景真的太美了！有想去的朋友可以问我攻略~
          </p>
          
          <!-- 图片展示 -->
          <div class="message-images">
            <img src="https://picsum.photos/400/300?random=10" alt="旅行照片1">
            <img src="https://picsum.photos/400/300?random=11" alt="旅行照片2">
            <img src="https://picsum.photos/400/300?random=12" alt="旅行照片3">
          </div>
          
          <div class="d-flex justify-content-between align-items-center mt-3">
            <div class="d-flex gap-4">
              <button class="btn btn-link p-0 text-secondary">
                <i class="fa fa-heart-o me-1"></i> 56
              </button>
              <button class="reply-btn btn btn-link p-0 text-secondary">
                <i class="fa fa-reply me-1"></i> 回复(12)
              </button>
            </div>
            <button class="btn btn-link p-0 text-secondary">
              <i class="fa fa-share-alt"></i>
            </button>
          </div>
          
          <!-- 回复输入框 -->
          <div class="reply-form">
            <div class="input-group">
              <input type="text" class="form-control rounded-pill" placeholder="写下你的回复...">
              <button class="btn btn-primary ms-2 rounded-pill">发送</button>
            </div>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 4. 紧凑式留言 -->
    <div class="message-section">
      <h6 class="fw-bold mb-3">紧凑式留言</h6>
      
      <div class="bg-white rounded-3 p-3 mb-3">
        <!-- 留言1 -->
        <div class="compact-message pb-3 border-bottom">
          <div class="d-flex">
            <img src="https://picsum.photos/200/200?random=7" class="message-avatar me-3" alt="用户头像">
            <div class="flex-grow-1">
              <div class="d-flex justify-content-between">
                <h6 class="mb-0 fw-bold">陈静</h6>
                <span class="message-time">今天 14:20</span>
              </div>
              <p class="message-content mb-2 text-sm">
                推荐一个很好用的学习资源网站，对提升技能很有帮助
              </p>
              <div class="d-flex gap-4">
                <button class="btn btn-link p-0 text-secondary text-sm">
                  <i class="fa fa-heart-o me-1"></i> 9
                </button>
                <button class="reply-btn btn btn-link p-0 text-secondary text-sm">
                  <i class="fa fa-reply me-1"></i> 回复(2)
                </button>
              </div>
              
              <!-- 回复输入框 -->
              <div class="reply-form">
                <div class="input-group">
                  <input type="text" class="form-control rounded-pill" placeholder="写下你的回复...">
                  <button class="btn btn-primary ms-2 rounded-pill">发送</button>
                </div>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 留言2 -->
        <div class="compact-message pt-3">
          <div class="d-flex">
            <div class="no-avatar me-3">
              <i class="fa fa-user"></i>
            </div>
            <div class="flex-grow-1">
              <div class="d-flex justify-content-between">
                <h6 class="mb-0 fw-bold">杨光</h6>
                <span class="message-time">昨天 11:05</span>
              </div>
              <p class="message-content mb-2 text-sm">
                有没有人想组队参加下个月的黑客马拉松？我们还缺一位前端开发
              </p>
              <div class="d-flex gap-4">
                <button class="btn btn-link p-0 text-secondary text-sm">
                  <i class="fa fa-heart-o me-1"></i> 13
                </button>
                <button class="reply-btn btn btn-link p-0 text-secondary text-sm">
                  <i class="fa fa-reply me-1"></i> 回复(4)
                </button>
              </div>
              
              <!-- 回复输入框 -->
              <div class="reply-form">
                <div class="input-group">
                  <input type="text" class="form-control rounded-pill" placeholder="写下你的回复...">
                  <button class="btn btn-primary ms-2 rounded-pill">发送</button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  
  <!-- 底部留言输入框 -->
  <div class="bottom-input">
    <div class="input-group">
      <button class="btn btn-link text-secondary p-1">
        <i class="fa fa-image"></i>
      </button>
      <input type="text" class="form-control rounded-pill" placeholder="分享你的想法...">
      <button class="btn btn-primary ms-2 rounded-pill">发布</button>
    </div>
  </div>

  <!-- Bootstrap JS -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
  
  <script>
    // 回复框显示/隐藏切换
    document.querySelectorAll('.reply-btn').forEach(btn => {
      btn.addEventListener('click', function() {
        // 找到当前留言块中的回复框
        const replyForm = this.closest('.card-body, .d-flex, .compact-message').querySelector('.reply-form');
        
        // 如果有其他打开的回复框则关闭
        document.querySelectorAll('.reply-form.active').forEach(form => {
          if (form !== replyForm) {
            form.classList.remove('active');
          }
        });
        
        // 切换当前回复框状态
        replyForm.classList.toggle('active');
        
        // 如果打开了回复框，自动聚焦
        if (replyForm.classList.contains('active')) {
          replyForm.querySelector('input').focus();
        }
      });
    });
    
    // 点赞功能
    document.querySelectorAll('.fa-heart-o').forEach(heart => {
      heart.addEventListener('click', function(e) {
        e.preventDefault();
        e.stopPropagation();
        
        const btn = this.closest('button');
        const countText = btn.textContent.trim();
        let count = parseInt(countText.split(' ')[1]);
        
        if (this.classList.contains('fa-heart-o')) {
          this.classList.remove('fa-heart-o');
          this.classList.add('fa-heart', 'text-danger');
          btn.innerHTML = `<i class="fa fa-heart text-danger me-1"></i> ${count + 1}`;
        } else {
          this.classList.remove('fa-heart', 'text-danger');
          this.classList.add('fa-heart-o');
          btn.innerHTML = `<i class="fa fa-heart-o me-1"></i> ${count - 1}`;
        }
      });
    });
  </script>
</body>
</html>
